package com.ugoodtech.mdcc.core.model.mapper;

import com.ugoodtech.mdcc.core.model.entity.CustomerRegularReport;
import com.ugoodtech.mdcc.core.model.entity.CustomerRegularReportExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface CustomerRegularReportMapper {
    @SelectProvider(type=CustomerRegularReportSqlProvider.class, method="countByExample")
    int countByExample(CustomerRegularReportExample example);

    @DeleteProvider(type=CustomerRegularReportSqlProvider.class, method="deleteByExample")
    int deleteByExample(CustomerRegularReportExample example);

    @Delete({
        "delete from customer_regular_report",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into customer_regular_report (id, creation_time, ",
        "deleted, enabled, update_time, ",
        "manage_note, managed, ",
        "score, sended, type, ",
        "user_id, customer_report_id, ",
        "regular_report_id, manage_user_id, ",
        "score_type)",
        "values (#{id,jdbcType=BIGINT}, #{creationTime,jdbcType=TIMESTAMP}, ",
        "#{deleted,jdbcType=BIT}, #{enabled,jdbcType=BIT}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{manageNote,jdbcType=VARCHAR}, #{managed,jdbcType=BIT}, ",
        "#{score,jdbcType=VARCHAR}, #{sended,jdbcType=BIT}, #{type,jdbcType=BIT}, ",
        "#{userId,jdbcType=BIGINT}, #{customerReportId,jdbcType=BIGINT}, ",
        "#{regularReportId,jdbcType=BIGINT}, #{manageUserId,jdbcType=BIGINT}, ",
        "#{scoreType,jdbcType=INTEGER})"
    })
    int insert(CustomerRegularReport record);

    @InsertProvider(type=CustomerRegularReportSqlProvider.class, method="insertSelective")
    int insertSelective(CustomerRegularReport record);

    @SelectProvider(type=CustomerRegularReportSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="creation_time", property="creationTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="deleted", property="deleted", jdbcType=JdbcType.BIT),
        @Result(column="enabled", property="enabled", jdbcType=JdbcType.BIT),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="manage_note", property="manageNote", jdbcType=JdbcType.VARCHAR),
        @Result(column="managed", property="managed", jdbcType=JdbcType.BIT),
        @Result(column="score", property="score", jdbcType=JdbcType.VARCHAR),
        @Result(column="sended", property="sended", jdbcType=JdbcType.BIT),
        @Result(column="type", property="type", jdbcType=JdbcType.BIT),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="customer_report_id", property="customerReportId", jdbcType=JdbcType.BIGINT),
        @Result(column="regular_report_id", property="regularReportId", jdbcType=JdbcType.BIGINT),
        @Result(column="manage_user_id", property="manageUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="score_type", property="scoreType", jdbcType=JdbcType.INTEGER)
    })
    List<CustomerRegularReport> selectByExample(CustomerRegularReportExample example);

    @Select({
        "select",
        "id, creation_time, deleted, enabled, update_time, manage_note, managed, score, ",
        "sended, type, user_id, customer_report_id, regular_report_id, manage_user_id, ",
        "score_type",
        "from customer_regular_report",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="creation_time", property="creationTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="deleted", property="deleted", jdbcType=JdbcType.BIT),
        @Result(column="enabled", property="enabled", jdbcType=JdbcType.BIT),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="manage_note", property="manageNote", jdbcType=JdbcType.VARCHAR),
        @Result(column="managed", property="managed", jdbcType=JdbcType.BIT),
        @Result(column="score", property="score", jdbcType=JdbcType.VARCHAR),
        @Result(column="sended", property="sended", jdbcType=JdbcType.BIT),
        @Result(column="type", property="type", jdbcType=JdbcType.BIT),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="customer_report_id", property="customerReportId", jdbcType=JdbcType.BIGINT),
        @Result(column="regular_report_id", property="regularReportId", jdbcType=JdbcType.BIGINT),
        @Result(column="manage_user_id", property="manageUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="score_type", property="scoreType", jdbcType=JdbcType.INTEGER)
    })
    CustomerRegularReport selectByPrimaryKey(Long id);

    @UpdateProvider(type=CustomerRegularReportSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CustomerRegularReport record, @Param("example") CustomerRegularReportExample example);

    @UpdateProvider(type=CustomerRegularReportSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CustomerRegularReport record, @Param("example") CustomerRegularReportExample example);

    @UpdateProvider(type=CustomerRegularReportSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CustomerRegularReport record);

    @Update({
        "update customer_regular_report",
        "set creation_time = #{creationTime,jdbcType=TIMESTAMP},",
          "deleted = #{deleted,jdbcType=BIT},",
          "enabled = #{enabled,jdbcType=BIT},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "manage_note = #{manageNote,jdbcType=VARCHAR},",
          "managed = #{managed,jdbcType=BIT},",
          "score = #{score,jdbcType=VARCHAR},",
          "sended = #{sended,jdbcType=BIT},",
          "type = #{type,jdbcType=BIT},",
          "user_id = #{userId,jdbcType=BIGINT},",
          "customer_report_id = #{customerReportId,jdbcType=BIGINT},",
          "regular_report_id = #{regularReportId,jdbcType=BIGINT},",
          "manage_user_id = #{manageUserId,jdbcType=BIGINT},",
          "score_type = #{scoreType,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(CustomerRegularReport record);
}